package com.shen.jcbf.thread;

/**
 * @author 怜笑
 * @company 公司
 * @create 2019-08-07 10:35
 */
public class TestThread2 implements Runnable {

    @Override
    public void run() {


//        int i = 1/0;

        for (int i = 0; i < 100; i++) {
            System.out.println("excute run ……  " + i);
        }

        int i = 1 / 0;

        try {
            Thread.currentThread().wait();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        System.out.println("excute run …… ^ ");
    }

    public static void main(String[] args) {
        Thread thread = new Thread(new TestThread2());
        boolean interrupted = true;
        thread.start();

        interrupted = thread.isInterrupted();
        System.out.println(interrupted + "-----1-status");

        try {
            Thread.sleep(2000);
            interrupted = thread.isInterrupted();
            System.out.println(interrupted + "-----2-status");
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

    }
}
